<template>
    <div>
        <InvestmentManagerStatisticsCondition
            @comReturn="comReturn"
            @handleButton="handleButtonEmit"
            :isFirst="isFirst && activeValue === 'investment-manager-statistic'"
            class="content"
        ></InvestmentManagerStatisticsCondition>
        <div class="noOpened">
            <RiskTableP
                :ref="'risk-table-' + type"
                :tableConfig="tableConfig"
                :tableData="tableData"
                :column="showColumns"
                :paging="paging"
                v-loading="tableLoading"
                @page-change="getTableData"
                @checkRowKeys-change="checkRowKeysChangeEmit"
                :key="tableKey"
            >
            </RiskTableP>
        </div>
        <RiskTableLayout
            ref="risk-table-layout"
            :tableName="layoutTableName"
            :visible.sync="layoutDialog"
            :column="tableColumns"
            :fixedColumns="fixedColumns"
        />
    </div>
</template>
<script lang="ts">
import RiskTableLayout from '@/common/components/risk-table-layout-plus.vue';
import RiskTableP from '@/common/components/risk-table-plus.vue';
import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
import InvestmentManagerStatisticsCondition from './investment-manager-statistic-condition.vue';
import { TransfiniteIndicator } from '../../class/transfinite-Indicator';
import API from '../../api/transfinite-Indicator';
import { InvestmentManagerStatisticDTO } from '../../vo/transfinite-Indicator';
export interface pages {
    total?: number;
    pageSize?: number;
    currentPage?: number;
}

@Component({ name: 'InvestmentManagerStatistic', components: { RiskTableLayout, RiskTableP, InvestmentManagerStatisticsCondition } })
export default class InvestmentManagerStatistic extends TransfiniteIndicator {
    @Prop() activeValue: string;

    type: string = 'invest';

    tableColumns: any = this.columnUtil.investmentManagerTableColumns;

    fixedColumns: any[] = [{ title: '投资经理', field: 'investmentManager' }];

    layoutTableName: string = 'TN_INVESTMENT_MANAGER_STATISTIC';

    requestTableMethodName: any = API.investmentManagerStatisticList;

    loadOutRequestName: any = API.downLoadFileManager;

    searchParam: InvestmentManagerStatisticDTO = {
        investmentManager: [],
        eventStatus: '',
        startTradeDate: '',
        endTradeDate: '',
    };

    @Watch('activeValue', { immediate: true })
    async handleActiveValue() {
        if (this.activeValue === 'investment-manager-statistic') {
            if (this.isFirst) {
                this.getTableData();
                this.isFirst = false;
            }
        }
    }

    mounted() {
        // 监听布局设置
        super.watchShowColumns();
    }

    getTableData() {
        return super.getTableData();
    }

    async handleButtonEmit(type: string) {
        await super.handleButtonEmit(type);
    }

    comReturn(obj) {
        super.comReturn(obj);
    }
}
</script>
<style lang="scss" scoped>
.content {
    padding: 5px 2px;
    border: 1px solid #f2f2f2;
    margin-bottom: 10px;
}
.noOpened /deep/ .vxe-table {
    .vxe-table--body-wrapper.body--wrapper {
        height: calc(100vh - 270px) !important;
    }
}
</style>
